package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.Social;
import com.miku.blog.domain.param.WebsiteConfigParam;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.WebSiteConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author shkstart
 * @create ${}YEAR-06-14 7:10
 */
@Api(tags = "后台管理系统{博客配置}")
@RequestMapping("/admin")
@RestController
public class WebSiteConfigController {

    @Autowired
    private WebSiteConfigService webSiteConfigService;


    @SystemLog(notes = "获取博客配置详细信息信息{后台管理系统}")
    @ApiOperation(value = "获取博客配置详细信息信息接口", notes = "获取博客配置详细信息信息")
    @GetMapping("/website/config")
    public ResponseResult getWebSiteConfigInformation(){
        return webSiteConfigService.getWebSiteConfigInformation();
    }


    @SystemLog(notes = "更新交友信息{后台管理系统}")
    @ApiOperation(value = "更新交友信息接口", notes = "更新交友信息")
    @PutMapping("/website/config/social")
    public ResponseResult updateSocial(@RequestBody List<Social> socials){
        return webSiteConfigService.updateSocial(socials);
    }

    @SystemLog(notes = "更新网站配置{后台管理系统}")
    @ApiOperation(value = "更新网站配置接口", notes = "更新 网站配置 及 网站资源 与 html5 websocket协议地址")
    @PutMapping("/website/config/res")
    public ResponseResult updateWebsiteConfigRes(@RequestBody WebsiteConfigParam websiteConfigParam){
        return webSiteConfigService.updateWebsiteConfigRes(websiteConfigParam);
    }

    @SystemLog(notes = "更新网站信息{后台管理系统}")
    @ApiOperation(value = "更新网站信息接口", notes = "更新 网站信息 及 登录方式")
    @PutMapping("/website/config/info")
    public ResponseResult updateWebsiteConfigInfo(@RequestBody WebsiteConfigParam websiteConfigParam){
        return webSiteConfigService.updateWebsiteConfigInfo(websiteConfigParam);
    }

}
